
//
// 120815 - (AH) - Created.
// 121014 - (AH) - (Midtun *) getListeners().
// 121015 - (AH) - (Midtun *) released().
//

package org.soekrat.conversationevent;

import java.util.List;

import org.soekrat.environment.Orb;

/**
 * <p>
 *   Interface for objects that publishes 
 *   {@code ConversationEvent} to
 *   {@link ConversationListener}s. 
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC) 
 */
public interface ConversationEventSource 
{
  /**
   * <p>
   *   Add listener.
   * </p>
   * @param l Listener to add.
   */
  void addListener(ConversationListener l);
  
  /**
   * <p>
   *   Remove listener.
   * </p>
   * @param l
   */
  void removeListener(ConversationListener l);
  
  /**
   * <p>
   *   Gets listeners {@code this} source have.
   * </p>
   * @return Listeners.
   */
  List<ConversationListener> getListeners();
  
  /**
   * <p>
   *   Causes events to be released regarding state change since creation or
   *   last time 
   *   {@link #clear()} was invoked. 
   * </p>
   * @param orb {@link Orb}.
   */
  void release(Orb orb);
  
  /**
   * <p>
   *   Forgets data. Next time 
   *   {@link #release()} is invoked only event related to state change after
   *   this method was invoked will be published.
   * </p>
   */
  void clear();
  
  /**
   * <p>
   *   Tells if 
   *   {@link #release(Orb)} has been invoked and
   *   {@link #clear()} yet not been (invoking 
   *   {@code clear()} makes {@code this} unreleased).
   * </p>
   * @return If {@code this} is released, {@code false} is not.
   */
  boolean released();
  
}
